Skip to content

feat(hbar): skip amount validation for claim rewards self-transfer#8784

Draft
Doddanna17 wants to merge 1 commit into
masterfrom
SI-605-hbar-skip-amount-validation-self-transfer
Draft

feat(hbar): skip amount validation for claim rewards self-transfer#8784
Doddanna17 wants to merge 1 commit into
masterfrom
SI-605-hbar-skip-amount-validation-self-transfer

Conversation

@Doddanna17
Copy link
Copy Markdown
Contributor

Summary

  • Add isHbarClaimRewards() helper to stakingWallet.ts (follows existing isBtcUndelegate(), isTrxStaking(), isStx() pattern)
  • Skip amount mismatch error in validateBuiltStakingTransaction() when HBAR claim rewards self-transfer is detected (sender address == recipient address)

Problem

After merging the wire format fix (PR #8774), HBAR claim rewards fails post-signing:

Staking transaction validation failed before signing: Recipient 0.0.8933725 amount mismatch. Expected: 1, Got: 0

Root cause: HBAR claim rewards is a 1-tinybar self-transfer. The wire format correctly merges [{acct, -1}, {acct, +1}] into [{acct, 0}], but validateBuiltStakingTransaction() compares buildParams.recipients[0].amount ("1") against explainedTransaction.outputs[0].amount ("0") and throws.

Why BitGoJS (not multi-repo fix)

Factor This approach Alternative (amount=0 end-to-end)
Files changed 1 file 3+ files across 2 repos
Base class risk None Modifies BaseClaimRewardsRequestStrategy (all coins)
Precedent BTC/TRX/STX have coin-specific exemptions No precedent
Semantic correctness Both "1" and "0" are correct at their layer Amount "0" is wrong -- we DO send 1 tinybar

Test plan

  • Existing stakingWalletNonTSS.ts tests pass (no regression)
  • HBAR claim rewards E2E on testnet passes post-signing validation
  • Normal HBAR transfers still validated (address mismatch still caught)

Ticket: SI-605

@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 15, 2026

SI-605

@Doddanna17 Doddanna17 force-pushed the SI-605-hbar-skip-amount-validation-self-transfer branch from f0cc9ed to dbe06cd Compare May 15, 2026 16:23
…ansfer

HBAR claim rewards uses a 1-tinybar self-transfer where the wire format
merges [{acct,-1},{acct,+1}] into [{acct,0}]. This causes a legitimate
amount mismatch (buildParams="1" vs explained="0") in
validateBuiltStakingTransaction. Add isHbarClaimRewards() guard to skip
the amount check when sender == recipient for HBAR claim rewards.

Add tests verifying the skip for claim_rewards and that non-claim
transactions still catch amount mismatches.

Ticket: SI-605
@Doddanna17 Doddanna17 force-pushed the SI-605-hbar-skip-amount-validation-self-transfer branch from dbe06cd to 52c47c2 Compare May 15, 2026 18:22
@Doddanna17 Doddanna17 marked this pull request as ready for review May 15, 2026 18:52
@Doddanna17 Doddanna17 requested review from a team as code owners May 15, 2026 18:52
@Doddanna17 Doddanna17 marked this pull request as draft May 15, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant